package chapter04;

class b{int a;}

// 加public 其他包才能访问
// 加public后 类名必须和文件名相同
class Chapter04 {
    String s;
    int[] n = new int[10];

    Chapter04(){
        n[0] = 5;
        s = "hello";
    }

    String getStr(){
        return this.s;
    }

    int getN(){
        return this.n[0];
    }

    void setN(int n){
        this.n[0] = n;
    }

    void testModifyN(b n){
        n.a = 1;
    }



    public static void main(String[] args){
        Chapter04 a = new Chapter04();
        System.out.println(a.getStr());
        System.out.println(a.getClass());

        System.out.println(a.getN());
        a.setN(100);
        System.out.println(a.getN());

        b t = new b();
        t.a = 10;
        System.out.println(t.a);
        a.testModifyN(t);
        System.out.println(t.a);




    }

}




